<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 打印当前时间  比如：周四[11:15:8] -->
    <script>
      //获取当前时间
      let date = new Date()
      //获取星期
      let day = date.getDay()
      let week = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
      //获取小时
      let hours = date.getHours()
      //获取分钟
      let min = date.getMinutes()
      //获取秒
      let sec = date.getSeconds()
      console.log(week[day] + '[' + hours + ':' + min + ':' + sec + ']')
    </script>
  </body>
</html>
